package com.xing.controller;

import com.xing.Utils.Result;
import com.xing.dto.ViewHistoryDTO;
import com.xing.service.ViewHistryService;
import com.xing.utils.PageData;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @version 1.0
 * @Author Xing
 * @Date 2024/4/27 16:54
 */
@Tag(name = "浏览记录")
@RestController
@RequestMapping("viewHistory")
public class ViewHistoryController {

    @Autowired
    private ViewHistryService service;

    @Operation(summary = "获取自己浏览记录")
    @GetMapping("viewHistory")
    public Result GetViewHistory(@RequestParam("page") Integer page,@RequestParam("limit") Integer limit){
        PageData<ViewHistoryDTO> list = service.GetViewHistory(page,limit);
        return new Result().ok(list);
    }

    @Operation(summary = "删除浏览记录")
    @DeleteMapping("{id}")
    public Result DelViewHistory(@PathVariable("id") Long id){
        service.DeleteViewHistory(id);
        return new Result().ok();
    }


}
